﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
using Meek.Storage;
using Microsoft.Practices.Unity;
using System.Web.Optimization;
using System.IO.Compression;


namespace Everynet
{
    // Note: For instructions on enabling IIS6 or IIS7 classic mode, 
    // visit http://go.microsoft.com/?LinkId=9394801

    public class MvcApplication : System.Web.HttpApplication
    {
        public static void RegisterGlobalFilters(GlobalFilterCollection filters)
        {
            filters.Add(new HandleErrorAttribute());
              
        }

        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{directory}/{resource}.asmx/{*pathInfo}");
            routes.IgnoreRoute("{resource}.asmx/{*pathInfo}");
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapRoute(
                "Default", // Route name
                "{controller}/{action}/{id}", // URL with parameters
                new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
            );
        }
        //for Meek CMS
        protected void Application_Error()
        {
            var error = Server.GetLastError();
        }

        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            RegisterGlobalFilters(GlobalFilters.Filters);
            RegisterRoutes(RouteTable.Routes);
            RegisterBundles(BundleTable.Bundles);
            BundleTable.EnableOptimizations = true;
        }


       

        public void RegisterBundles(BundleCollection bundles)
        {
            #region[Style]
            //Layout Master Page and Sign up Layout Page
            bundles.Add(new StyleBundle("~/Content/bundledcss").Include(
                "~/Content/style.css"
                )
              );
               
            //Layout Configuration Page
            bundles.Add(new StyleBundle("~/Content/bundledconfigcss").Include(
                "~/Content/jqueryaccordian.css"
                )
             );
            #endregion
            #region[Scripts]
            //Layout Master Page
            bundles.Add(new ScriptBundle("~/Scripts/BundledScripts").Include(
                "~/Scripts/jquery-1.5.1.min.js",
                "~/Scripts/mmswap.js",
                "~/Scripts/jquery.cookie.js",
                 "~/Scripts/client/bottomchk.js",
                 "~/Scripts/client/headerchk.js"

                 )
            );
            //Layout Home Page
            bundles.Add(new ScriptBundle("~/Scripts/BundledScriptsHome").Include(
                "~/Scripts/jquery.validate.min.js",
                "~/Scripts/jquery.validate.unobtrusive.min.js",
                "~/Scripts/jquery-ui-1.8.11.min.js",
                 "~/Scripts/client/home.js"
                 )
            );

            //Signup Layout
            bundles.Add(new ScriptBundle("~/Scripts/BundledScriptsSignup").Include(
               "~/Scripts/jquery-1.5.1.min.js",
               "~/Scripts/mmswap.js",
               "~/Scripts/jquery.validate.min.js",
                "~/Scripts/jquery.cookie.js",
                "~/Scripts/jquery.validate.unobtrusive.min.js",
                "~/Scripts/jquery-ui-1.8.11.min.js",
                "~/Scripts/client/headerchk.js",
                "~/Scripts/client/bottomchk.js"
                 )
           );


            //Signup Layout Home Page
            bundles.Add(new ScriptBundle("~/Scripts/BundledScriptsSignupHome").Include(
                "~/Scripts/jquery.unobtrusive-ajax.min.js",
                "~/Scripts/client/signUp.js",
                "~/Scripts/client/signUpDetail.js"
                )
            );

            // Signup Configuration
            bundles.Add(new ScriptBundle("~/Scripts/BundledScriptsSignupConfiguration").Include(
                "~/Scripts/client/signUp.js",
                "~/Scripts/client/configuration.js",
                "~/Scripts/client/configurationDetail.js"
                )
            );
            #endregion
        }

    }
}